<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>绑定微信</button>
    <script>
        ws = new WebSocket("ws://127.0.0.1:2347");
        ws.onopen = function() {
            console.log("连接成功");
        };
        ws.onmessage = function(e) {
            console.log(e.data);
        };
        document.querySelector('button').onclick = function(){
            ws.send('close');
        }
    </script>
</body>
</html>